package interview.javabase.thread.aqs.countdownlatch;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.CountDownLatch;

/**
 * 线程类
 */
@Slf4j
@SuppressWarnings("all")
public class Runner implements Runnable {

    private final CountDownLatch startLatch;

    public Runner(CountDownLatch startLatch) {
        this.startLatch = startLatch;
    }

    @Override
    public void run() {
        try {
            // 线程等待
            startLatch.await();

            System.out.println("并发:" + Thread.currentThread().getName());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}